A Device-to-Device (D2D) communication technology is a technology configured to determine proximity between two or more pieces of D2D User Equipment (UE) or configured to determine that first UE is proximal to second UE, and is a technology for implementing direct communication of part or all of communication data between D2D UE without a network infrastructure. There are mainly three D2D communication application scenarios: first, two pieces of D2D UE perform data interaction under coverage of a cellular network, and their user plane data does not pass through a network infrastructure; 2, in an area with weak or no cellular network coverage, relay transmission may be implemented through other D2D UE; and 3, direct communication among multiple pieces of D2D UE is allowed under the condition that a cellular network may not work normally.
When D2D UE is located in a coverage area of a cellular network, a D2D communication resource is usually acquired in an Evolved Node B (eNB)-based scheduling manner; while when the D2D UE moves out of the coverage area of the cellular network, a resource is required to be acquired in a contention manner.
However, the problem of how to determine switching from an eNB-based allocation manner to a contention-based resource allocation manner in a process of movement of D2D UE out of network coverage is not solved in a conventional art. Moreover, if D2D UE determines it moves out of network coverage too late, the D2D UE may be disconnected from an eNB or a Radio Link Failure (RLF) may occur before a contention-based resource allocation mechanism is started, that is, a D2D resource allocated by the eNB may not be acquired, and consequently, continuity and quality of service of a D2D service may be influenced. But if the D2D UE determines it moves out of the network coverage too early, the D2D UE within the network coverage is automatically switched to acquire the D2D resource in a contention manner and the D2D resource gets out of control of the eNB.